package com.lsl.decorator.decorator2;


import com.lsl.decorator.decorator2.burger.ChickenBurger;
import com.lsl.decorator.decorator2.burger.Hamburger;
import com.lsl.decorator.decorator2.condiment.Chilli;
import com.lsl.decorator.decorator2.condiment.Lettuce;
import com.lsl.decorator.decorator2.condiment.Prosciutto;

public class Test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Hamburger hamburger = new ChickenBurger();
        System.out.println(hamburger.getName() + "  价钱：" + hamburger.getPrice());
        //只加生菜
        Lettuce lettuce = new Lettuce(hamburger);
        System.out.println(lettuce.getName() + "  价钱：" + lettuce.getPrice());
        //只加辣椒
        Chilli chilli = new Chilli(hamburger);
        System.out.println(chilli.getName() + "  价钱：" + chilli.getPrice());
        //只加火腿
        Prosciutto prosciutto = new Prosciutto(hamburger);
        System.out.println(prosciutto.getName() + "  价钱：" + prosciutto.getPrice());

        //加生菜+辣椒
        Chilli chilli2 = new Chilli(lettuce);
        System.out.println(chilli2.getName() + "  价钱：" + chilli2.getPrice());

        //生菜+火腿
        Prosciutto prosciutto1 = new Prosciutto(lettuce);
        System.out.println(prosciutto1.getName() + "  价钱：" + prosciutto1.getPrice());

        //生菜+火腿+辣椒
        Chilli lastHamburger = new Chilli(prosciutto1);
        System.out.println(lastHamburger.getName() + "  价钱：" + lastHamburger.getPrice());


        Chilli lastChilliHamburger = new Chilli(new Lettuce(new Prosciutto(new ChickenBurger())));
        System.out.println(lastChilliHamburger.getName() + "  价钱：" + lastChilliHamburger.getPrice());
    }

}
